PIP使用详解及常用命令汇总 您所在的位置:网站首页 pip 安装命令 PIP使用详解及常用命令汇总

PIP使用详解及常用命令汇总

2022-10-06 22:37| 来源: 网络整理| 查看: 265

PIP使用详解及常用命令汇总 简介PIP的安装Windows安装Linux安装 PIP常用命令安装使用包查看安装包检查升级包卸载包其他命令 高效的PIP安装镜像参考文献

简介

pip主要是用于安装及维护Python包。

PIP的安装 Windows安装

Windows下是默认安装pip工具的,只需要将python安装目录下的scripts目录加入环境变量Path中即可,安装后便可以使用命令查找。

Linux安装

执行下面命令即可完成安装

# wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate # python get-pip.py PIP常用命令 安装使用包 ## 安装包 pip install package_name ## 批量安装(txt为需要安装的文档) pip install -r requirements.txt 查看安装包 ## 查看当前环境下的所有包 pip list ## 查看指定的安装包 pip show --files package_name 检查升级包 ## 查看需要更新的所有包 pip list --outdated ## 更新指定的包 pip install --upgrade package_name ## 更新pip自身 python -m pip install –upgrade pip ## 安装review库来帮助更新所有过期库 pip install pip-review pip-review –local –interactive 卸载包 pip uninstall package_name 其他命令

可以使用pip –help命令,查看pip帮助文档,里面包含一般常用的pip命令功能。

Usage: pip [options] Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. config Manage local and global configuration. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. debug Show information useful for debugging. help Show help for commands. General Options: -h, --help Show help. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log Path to a verbose appending log. --proxy Specify a proxy in the form [user:passwd@]proxy.server:port. --retries Maximum number of retries each connection should attempt (default 5 times). --timeout Set the socket timeout (default 15 seconds). --exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort. --trusted-host Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS. --cert Path to alternate CA bundle. --client-cert Path to SSL client certificate, a single file containing the private key and the certificate in PEM format. --cache-dir Store the cache data in . --no-cache-dir Disable the cache. --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index. --no-color Suppress colored output --no-python-version-warning Silence deprecation warnings for upcoming unsupported Pythons. 高效的PIP安装镜像

对于PIP的安装来说,有时候直接使用命令从官网获取会比较慢,甚至会出现中断的情况,这时候,通过一些国内镜像源来安装,会速度快一些。

注意:http和https: pip install --index-url xxx_url package_name

例如:pip快速安装scikit-learn指令如下: pip install --index-url https://pypi.douban.com/simple scikit-learn (1) xxx_url :https://pypi.douban.com/simple (2) package_name:module_name

可用国内 xxx_url 如下:

清华:https://pypi.tuna.tsinghua.edu.cn/simple阿里云:http://mirrors.aliyun.com/pypi/simple/中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/华中理工大学:http://pypi.hustunique.com/山东理工大学:http://pypi.sdutlinux.org/豆瓣:http://pypi.douban.com/simple/ 参考文献

【1】pip命令使用详解:https://blog.csdn.net/guoyajie1990/article/details/81089915 【2】pip常用命令汇总:https://blog.csdn.net/dk1543100966/article/details/81230150 【3】windows环境,pip的使用大全: https://blog.csdn.net/qq_43387744/article/details/83271813

作者简介 作者:榆尚天 简介:一个数据分析的爱好者,立志成为一名数据界的幽灵。 微信平台:数据幽灵 在这里插入图片描述 期待与各位同道的交流,欢迎关注~~~ ———————————————————————————— 作者:榆尚天 出处:https://blog.csdn.net/weixin_42926612/article/details/106972495 说明:本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有